// pages/invoice-success/invoice-success.js
Page({
  data: {
    invoiceInfo: {},
    successInfo: {
      status: '申请成功',
      message: '您的发票申请已提交，预计1-3个工作日开具完成',
      invoiceNumber: 'INV202501150001'
    }
  },

  onLoad: function(options) {
    // 接收发票信息
    this.setData({
      invoiceInfo: {
        id: options.invoiceId,
        type: options.type,
        amount: options.amount,
        date: options.date,
        department: options.department,
        doctor: options.doctor
      }
    });
  },

  // 查看电子发票
  viewInvoice: function() {
    wx.navigateTo({
      url: `/pages/view-invoice/view-invoice?invoiceId=${this.data.invoiceInfo.id}&type=${this.data.invoiceInfo.type}&amount=${this.data.invoiceInfo.amount}&date=${this.data.invoiceInfo.date}&department=${this.data.invoiceInfo.department}&doctor=${this.data.invoiceInfo.doctor}`
    });
  },

  // 返回首页
  goHome: function() {
    wx.reLaunch({
      url: '/pages/index/index'
    });
  }
});
